<?php
	require_once "inc/functions.php";
	
	$s = new mysql();
	$sql ="SELECT name,contanct_id, COUNT( contanct_id ) num FROM contanct_logs,contancts WHERE contanct_logs.user_id =".$_SESSION["SESS_USERID"]." and contanct_logs.contanct_id = contancts.id GROUP BY contanct_id ORDER BY num DESC limit 0,20";
	$s->excu($sql);
	echo $s->error_msg;
	while($r = @mysql_fetch_assoc($s->rs))
	{
		//print_r($r);
		//echo $r["name"];
		//echo $r["num"];
		$result[$i++]=$r;
	}
?>
<fieldset>
	<legend><?php echo tran("contanct").tran("report");?></legend>
	<?php
		foreach($result as $k=>$v)
		{
			$size = $v["num"]*50;
			echo "<div style='width:$v[num]00px; background:inactivecaption; padding:3px; border:1px solid blue; margin-bottom:3px;'><span style='color:yellow;font-size:{$size}%'>$v[name]</span><span style='float:right; padding-right:5px;color:red;'>$v[num]</span></div>";
		}
	?>
</fieldset>